﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WebComix.Gui
{
    /// <summary>
    /// Предварительный просмотр списка комиксов.
    /// </summary>
    public class WebComixRangePreview : WebComixViewerBase
    {
        static WebComixRangePreview()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(WebComixRangePreview), new FrameworkPropertyMetadata(typeof(WebComixRangePreview)));
        }

        /// <summary>
        /// Обработчик команды "Reload".
        /// </summary>
        /// <param name="e">Параметр события.</param>
        protected override void OnReloadCommand(ExecutedRoutedEventArgs e)
        {
            if (ComixRange != null)
            {
                ComixRange.Reload();
            }
        }

        /// <summary>
        /// Список комиксов.
        /// </summary>
        public WebComixGuiRecordRange ComixRange
        {
            get { return (WebComixGuiRecordRange)GetValue(ComixRangeProperty); }
            set { SetValue(ComixRangeProperty, value); }
        }

        /// <summary>
        /// Список комиксов.
        /// </summary>
        public static readonly DependencyProperty ComixRangeProperty =
            DependencyProperty.Register("ComixRange", typeof(WebComixGuiRecordRange), typeof(WebComixRangePreview), new UIPropertyMetadata(null));

        /// <summary>
        /// Выбранный комикс.
        /// </summary>
        public WebComixGuiRecord Current
        {
            get { return (WebComixGuiRecord)GetValue(CurrentProperty); }
            set { SetValue(CurrentProperty, value); }
        }

        /// <summary>
        /// Выбранный комикс.
        /// </summary>
        public static readonly DependencyProperty CurrentProperty =
            DependencyProperty.Register("Current", typeof(WebComixGuiRecord), typeof(WebComixRangePreview), new UIPropertyMetadata(null));

        /// <summary>
        /// Индекс выбранного комикса.
        /// </summary>
        public int CurrentIndex
        {
            get { return (int)GetValue(CurrentIndexProperty); }
            set { SetValue(CurrentIndexProperty, value); }
        }

        /// <summary>
        /// Индекс выбранного комикса.
        /// </summary>
        public static readonly DependencyProperty CurrentIndexProperty =
            DependencyProperty.Register("CurrentIndex", typeof(int), typeof(WebComixRangePreview), new UIPropertyMetadata(-1));

        /// <summary>
        /// Ширина изображения.
        /// </summary>
        public double PreviewWidth
        {
            get { return (double)GetValue(PreviewWidthProperty); }
            set { SetValue(PreviewWidthProperty, value); }
        }

        /// <summary>
        /// Ширина изображения.
        /// </summary>
        public static readonly DependencyProperty PreviewWidthProperty =
            DependencyProperty.Register("PreviewWidth", typeof(double), typeof(WebComixRangePreview), new UIPropertyMetadata(120.0));
    }
}
